package com.qf.boot2204.controller;

import com.qf.boot2204.entity.User;
import com.qf.boot2204.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;


@CrossOrigin/*解决跨越问题*/
@Controller
@RequestMapping("/test")
public class TestController {
    @Autowired
    TestService testService;
    @Autowired
    @Qualifier("user1")
    User user;

    @GetMapping("/user")
    @ResponseBody
    public User getUser(){
        return user;
    }

    @GetMapping("/test1")
    @ResponseBody
    public String test1(String name){
        return "hello "+name;
    }

    @PostMapping("/test2")
    @ResponseBody
    public String test2(String name){
        System.out.println("hello "+name);
        return "hello "+name;
    }

}
